package com.fz.mapper;

import com.fz.entity.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by David on 2017-07-06.
 */
@Component("bd")  @Transactional
public interface BookMapper {
    public List<Book> query();

    @Delete("delete from book where book_id=#{id}")
    public int delById(int id);

    @Select("select * from book where book_id=#{id}") @ResultMap("bookmap")
    public Book queryById(int id);

    @Select("select book_name from book")
    public List<String> queryName();
}
